#include "instanceobj.h"

#include <QMenu>
#include <QMessageBox>
#include <QWidget>
#include <qsciscintilla.h>

extern std::function<QsciScintilla*(QWidget*)> s_getCurEdit;

InstanceObj::InstanceObj(QWidget* pNotepad, QMenu* pMenu)
    : QObject(pNotepad)
{
    m_pNotepad = pNotepad;
    m_rootMenu = pMenu;
}

InstanceObj::~InstanceObj()
{
}

void InstanceObj::run()
{
    QsciScintilla* hCurrScintilla = s_getCurEdit(m_pNotepad);
    if (hCurrScintilla == nullptr) {
        return;
    }

    QMessageBox::information(m_pNotepad, "text content", hCurrScintilla->text());
}
